<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <div class="btn left"><button v-show="index>0" @click="index--">上一页</button></div>
        <img :src="list[index]" alt="">
        <div class="btn right"><button v-show="index<list.length-1" @click="index++">下一页</button></div>
    </div>
    <script src="./js/vue.js"></script>
    <script>
        const app = new Vue({
            el: "#app",
            data: {
                index: 0,
                list: [
                    "./images/1.jpg",
                    "./images/2.jpg",
                    "./images/3.jpg",
                    "./images/4.jpg",
                    "./images/5.jpg",
                    "./images/6.jpg",
                ]
            }
        })

    </script>

    <style>
        *{
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }
        #app {
            width: 640px;
            height: 360px;
            position: relative;
            display: flex;
            /* width: 500px; */
            /* justify-content: space-around; */
        }

        #app img {
            display: block;
        }

        .btn {
            display: inline-block;
            width: 100px;
            height: 20px;
            background-color: pink;
        }
        .btn.left {
            /* height: 360px; */
            /* line-height: 360px; */
            position: absolute;
            left: 0px;
            top: 50%;
        }

        .btn.right {
            position: absolute;
            right: 0px;
            /* line-height: 360px; */
            top: 50%;
    </style>


    </div>
</body>

</html>